Component({
  data: {
    selected: 0,
    color: '#666',
    selectedColor: '#4caf50',
    list: [
      {
        pagePath: '/pages/home/index',
        text: '首页',
        iconPath: '/static/tabbar/home-icon.png',
        selectedIconPath: '/static/tabbar/home-icon_.png',
        name: 'home',
      },
      // {
      //   pagePath: '/pages/cookbook/index',
      //   text: '食谱',
      //   iconPath: '/static/tabbar/cookbook-icon.png',
      //   selectedIconPath: '/static/tabbar/cookbook-icon_.png',
      //   name: 'cookbook',
      // },
      {
        pagePath: '/pages/history/index',
        text: '饮食记录',
        iconPath: '/static/tabbar/history-icon.png',
        selectedIconPath: '/static/tabbar/history-icon_.png',
        name: 'history',
      },
      {
        pagePath: '/pages/my/index',
        text: '我的',
        iconPath: '/static/tabbar/my-icon.png',
        selectedIconPath: '/static/tabbar/my-icon_.png',
        name: 'my',
      },
    ],
  },
  attached() {},
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({ url })
    },
  },
})
